class Solution {
public:
    int findContentChildren(vector<int>& g, vector<int>& s) {
        sort(g.begin(),g.end());
        sort(s.begin(),s.end());
        int x=0;
        int y=0;
        int ret=0;
        while(x<g.size()&&y<s.size())
        {
            if(g[x]<s[y]||g[x]==s[y])
            {
                ret++;
                x++;
                y++;
            }
            else
            {
                y++;
            }
        }
        return ret;
    }
};
